﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<RuiJing.Web.Areas.Manage.Models.NewsModels.EditNewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%="Add".Equals(Model.Action, StringComparison.CurrentCultureIgnoreCase) ? "发布" : "编辑" %>新闻
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
<% var isnew = "Add".Equals(Model.Action, StringComparison.CurrentCultureIgnoreCase); %>
<% Html.BeginForm(new { id="editnewform" },null); %>
    <fieldset>
        <legend><%="Add".Equals(Model.Action, StringComparison.CurrentCultureIgnoreCase) ? "发布" : "编辑" %>新闻</legend>
        <%=Html.ActionLink(">>返回", "index")%>
        <ul class="editpanel">
            <% if (!isnew) %>
            <% { %>
            <li class="edititem">
                <label for="Title" class="label">发布时间：</label>
                <div class="edititemcontent">
                    <%=string.Format("{0:yyyy-MM-dd HH:mm}",Model.AddTime) %>
                </div>
            </li>
            <% } %>
            <li class="edititem">
                <label for="Title" class="label">标题：</label>
                <div class="edititemcontent">
                    <%=Html.TextBoxFor(p => p.Title, new { @class="w500"})%>
                    <%=Html.ValidationMessageFor(p=>p.Title) %>
                </div>
            </li>
            <li class="edititem">
                <label class="label">状态：</label>
                <div class="edititemcontent">
                    <label><%=Html.RadioButtonFor(p=>p.State,NewState.Enabled) %><%=NewState.Enabled.Name() %></label>
                    <label><%=Html.RadioButtonFor(p=>p.State,NewState.Disabled) %><%=NewState.Disabled.Name() %></label>
                    <%=Html.ValidationMessageFor(p=>p.State) %>
                </div>
            </li>
            <li class="edititem">
                <label class="label">高亮：</label>
                <div class="edititemcontent">
                    <label><%=Html.RadioButtonFor(p=>p.Highlight,true) %>是</label>
                    <label><%=Html.RadioButtonFor(p=>p.Highlight,false) %>否</label>
                    <%=Html.ValidationMessageFor(p=>p.Highlight) %>
                </div>
            </li>
            <li class="edititem">
                <label class="label">语言：</label>
                <div class="edititemcontent">
                    <% foreach (var l in Model.Lanaguages) %>
                    <% { %>
                    <label><%=Html.RadioButtonFor(p => p.Language, l)%><%=l.Name()%></label>
                    <% } %>
                    <%=Html.ValidationMessageFor(p=>p.State) %>
                </div>
            </li>
            <li class="edititem textarea">
                <%=Html.TextAreaFor(p=>p.Content) %>
            </li>
            <li class="edititem btnpanel">
                <input type="submit" value="保存" />
            </li>
        </ul>
    </fieldset>
    <%=Html.HiddenFor(p=>p.ID) %>
    <%=Html.HiddenFor(p=>p.AddTime) %>
<% Html.EndForm(); %>
</div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StypeAndScript" runat="server">
    <style type="text/css">
        .textarea{ line-height:normal; }
        .textarea table{margin:0px; text-align:left;}
    </style>
    <script src='<%=Url.Content("~/Scripts/htmlbox4.0/htmlbox.colors.js") %>' type="text/javascript"></script>
    <script src='<%=Url.Content("~/Scripts/htmlbox4.0/htmlbox.styles.js") %>' type="text/javascript"></script>
    <script src='<%=Url.Content("~/Scripts/htmlbox4.0/htmlbox.syntax.js") %>' type="text/javascript"></script>
    <script src='<%=Url.Content("~/Scripts/htmlbox4.0/htmlbox.full.js") %>' type="text/javascript"></script>
    <script src='<%=Url.Content("~/Scripts/htmlbox4.0/xhtml.js") %>' type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#editnewform textarea").css({ width: "100%", height: "400px" }).htmlbox({
                toolbars: [
                [
                // Cut, Copy, Paste
                "separator", "cut", "copy", "paste",
                // Undo, Redo
                "separator", "undo", "redo",
                // Bold, Italic, Underline, Strikethrough, Sup, Sub
                "separator", "bold", "italic", "underline", "strike", "sup", "sub", "removeformat",
                // Left, Right, Center, Justify
                "separator", "justify", "left", "center", "right",
                // Ordered List, Unordered List, Indent, Outdent
                "separator", "ol", "ul", "indent", "outdent",
                // Hyperlink, Remove Hyperlink, Image
                "separator", "link", "unlink", "image"
                ],
                [// Show code
                "separator", "code",
                // Formats, Font size, Font family, Font color, Font, Background
                "separator", "formats", "fontsize", "fontfamily",
                "separator", "fontcolor", "highlight"
                ]
                ],
                skin: "blue",
                idir: '<%=Url.Content("~/Scripts/htmlbox4.0/images/") %>',
                about: false
            });
        });
    </script>
</asp:Content>